from flask_cors import CORS

from apps.user.urls import user_route
from apps.user.view import user_blueprint
from config_repo import apiserver


class AppSequence(object):
    def __init__(self,app=None):
        if not app:
            pass
        self.app = app

    def start(self):
        self.app_config()
        self.register()
        self._route()

        return self.app

    def app_config(self):
        CORS(self.app,**{"cors":apiserver['cors']})

    def register(self):
        self.app.register_blueprint(user_blueprint, url_prefix='/user')

    def _route(self):
        user_route()